public with Sharing class Cald_SearchClaimsVF
{
    public Boolean displayExportPaymentFlag {get; set;}
    public String opportunityName {get; set;}
    public String claimStatus {get; set;}
    public String claimName {get; set;}
    public Date filingDate {get; set;}
    public Callidus_Claim__c c {get; set;}
    
    public String claimedCreditOperator {get; set;}
    public String approvedCreditOperator {get; set;}
    public String claimedCommissionOperator {get; set;}
    public String approvedCommissionOperator {get; set;}
    
    public Double claimedCreditAmount {get; set;}
    public Double approvedCreditAmount {get; set;}
    public Double claimedCommissionAmount {get; set;}
    public Double approvedCommissionAmount {get; set;}
    
    
    public ID withdrawnClaimId {get; set;}
    public Callidus_Claim__c[] claimsList {get; set;}
    public Callidus_Claim__c[] approvedClaimsList {get; set;}
    static String testVar = '';
    
    public Cald_SearchClaimsVF()
    {
        c = new Callidus_Claim__c();
        
        claimsList = null;
        claimName = null;
        
        Profile[] p = [select Name from Profile where id = :Userinfo.getProfileId()];
        displayExportPaymentFlag = false;
        if(p.size() > 0 && p[0].name == 'System Administrator')
            displayExportPaymentFlag = !displayExportPaymentFlag;
            
    }
    
/*    public PageReference delRecs()
    {
    	for(Callidus_Claim_Status_Credit__c[] cscList : [select id from Callidus_Claim_Status_Credit__c])	
    		delete cscList;
    	for(Callidus_Plan_Participant__C[] cpp : [select id from Callidus_Plan_Participant__c])
    		delete cpp;
    	for(Callidus_Claim__c[] cList: [select id from Callidus_Claim__c])
    		delete cList;
    	for(Callidus_Dispute__c[] dList: [select id from Callidus_Dispute__c])
    		delete dList;
    	return null;
    }
	*/
	
	public List<SelectOption> getClaimedCreditOptions()
	{
		List<SelectOption> options = new List<SelectOption>();
		options.add(new SelectOption('<', 'Less Than'));
		options.add(new SelectOption('=', 'Equals'));
		options.add(new SelectOption('>', 'Greater Than'));
		return options;
	}

	public List<SelectOption> getApprovedCreditOptions()
	{
		List<SelectOption> options = new List<SelectOption>();
		options.add(new SelectOption('<', 'Less Than'));
		options.add(new SelectOption('=', 'Equals'));
		options.add(new SelectOption('>', 'Greater Than'));
		return options;
	}

	public List<SelectOption> getClaimedCommissionOptions()
	{
		List<SelectOption> options = new List<SelectOption>();
		options.add(new SelectOption('<', 'Less Than'));
		options.add(new SelectOption('=', 'Equals'));
		options.add(new SelectOption('>', 'Greater Than'));
		return options;
	}

	public List<SelectOption> getApprovedCommissionOptions()
	{
		List<SelectOption> options = new List<SelectOption>();
		options.add(new SelectOption('<', 'Less Than'));
		options.add(new SelectOption('=', 'Equals'));
		options.add(new SelectOption('>', 'Greater Than'));
		return options;
	}

    
    
    public PageReference updateClaimObject()
    {
    	for(Callidus_Claim__c[] claimsDraftList:[select Id from Callidus_Claim__c where Claim_Status__c = 'Draft'])
    	{
    		delete claimsDraftList;
    	}
        return null;
    }


    public PageReference exportPayment()
    {
    	PageReference p = null;
        if(claimsList != null && claimsList.size() > 0)
        {
	        p = new PageReference('/apex/Cald_Export_Payment?oId='+c.Opportunity__c+'&s='+claimStatus+'&cn='+claimName+'&fd='+c.Filing_Date__c);
        }
        return p;
    }

    public PageReference getPayments()
    {
		String status = ApexPages.currentPage().getParameters().get('s');
		String oId = ApexPages.currentPage().getParameters().get('oId');
		String cn = ApexPages.currentPage().getParameters().get('cn');
		String dt = ApexPages.currentPage().getParameters().get('fd');
		Date d;
		
		if(testVar == '' && dt != 'null')
			d = Date.valueOf(dt);
		else
			d = null;
		
		if(cn == 'null')
			cn = '%';
		else
			cn = '%'+cn+'%';
		
		if(status == 'select')
			status = '%';

		if(oId == 'null')	
			approvedClaimsList = [select Name, Owner.Name, Opportunity__r.Name, Credit__c, Adjusted_Credit__c, Filing_Date__c, Commission_Amount__c, Adjusted_Commission__c, Claim_Status__c from Callidus_Claim__c where Claim_Status__c like :status and Claim_Status__c != 'Draft' and Name like :cn and Filing_Date__c <= :d]; 
		else
			approvedClaimsList = [select Name, Owner.Name, Opportunity__r.Name, Credit__c, Adjusted_Credit__c, Filing_Date__c, Commission_Amount__c, Adjusted_Commission__c, Claim_Status__c from Callidus_Claim__c where Opportunity__c = :oId and Claim_Status__c like :status and Claim_Status__c != 'Draft' and Name like :cn and Filing_Date__c <= :d];
        //approvedClaimsList = [select Name, Owner.Name, Opportunity__r.Name, Credit__c, Adjusted_Credit__c, Commission_Amount__c, Adjusted_Commission__c, Claim_Status__c from Callidus_Claim__c where Claim_Status__c = 'Approved' or Claim_Status__c = 'Rejected' or Claim_Status__c = 'Pending Approval'];
        return null;
    }
        
    public List<SelectOption> getClaimStatusList()
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('%', 'Select'));
        options.add(new SelectOption('Pending Approval', 'Pending Approval'));
        options.add(new SelectOption('Approved', 'Approved'));
        options.add(new SelectOption('Rejected', 'Rejected'));
        options.add(new SelectOption('Withdrawn', 'Withdrawn'));
        return options;
    }
    
    
    public PageReference searchClaims()
    {
		//(select Requested_Credit__c, Requested_Commission__c, Requested_Rate__c, Split__c, Claim__c, Claimant__c, Approved_Credit__c, Approved_Commission__c from Claim_Details__r)	
		String formWhereClause = '';
		String formInnerWhereClause = ', (select Requested_Credit__c, Requested_Commission__c, Requested_Rate__c, Claim__c, Claimant__c, Approved_Credit__c, Approved_Commission__c from Claim_Details__r ';
		
        String[] statusList = new String[]{'Pending Approval', 'Approved', 'Rejected'};
		String draftStatus = 'Draft';
		String withdrawnStatus = 'Withdrawn';
		
        
		ID myID = UserInfo.getUserId();
        ID oppID = c.Opportunity__c;
         
        if(claimStatus != '%' && claimStatus != 'Withdrawn')
			formWhereClause += ' Claim_Status__c = :claimStatus ';
		else if(claimStatus == 'Withdrawn')
			formWhereClause += ' Claim_Status__c = :claimStatus and OwnerId = :myID ';
		else
			formWhereClause += ' Claim_Status__c != :draftStatus and Claim_Status__c in :statusList ';
		
		String name =  '%'+claimName+'%';
        if(claimName != '')
            formWhereClause += ' and name like :name ';
		
		if(oppID != null)
			formWhereClause += ' and Opportunity__c = :oppID ';

		if(claimedCreditOperator == '<' && claimedCreditAmount != 0)
		{
			formWhereClause += ' and Credit__c < :claimedCreditAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Requested_Credit__c < :claimedCreditAmount ';
			else 
				formInnerWhereClause += ' where Requested_Credit__c < :claimedCreditAmount ';
		}
		else if(claimedCreditOperator == '>' && claimedCreditAmount != 0)
		{
			formWhereClause += ' and Credit__c > :claimedCreditAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Requested_Credit__c > :claimedCreditAmount ';
			else 
				formInnerWhereClause += ' where Requested_Credit__c > :claimedCreditAmount ';
		}
		else if(claimedCreditOperator == '=' && claimedCreditAmount != 0)
		{
			formWhereClause += ' and Credit__c = :claimedCreditAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Requested_Credit__c = :claimedCreditAmount ';
			else 
				formInnerWhereClause += ' where Requested_Credit__c = :claimedCreditAmount ';
		}

		if(approvedCreditOperator == '<' && approvedCreditAmount != 0)
		{
			formWhereClause += ' and Adjusted_Credit__c < :approvedCreditAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Approved_Credit__c < :approvedCreditAmount ';
			else 
				formInnerWhereClause += ' where Approved_Credit__c < :approvedCreditAmount ';
		}
		else if(approvedCreditOperator == '>' && approvedCreditAmount != 0)
		{
			formWhereClause += ' and Adjusted_Credit__c > :approvedCreditAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Approved_Credit__c > :approvedCreditAmount ';
			else 
				formInnerWhereClause += ' where Approved_Credit__c > :approvedCreditAmount ';
		}
		else if(approvedCreditOperator == '=' && approvedCreditAmount != 0)
		{
			formWhereClause += ' and Adjusted_Credit__c = :approvedCreditAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Approved_Credit__c = :approvedCreditAmount ';
			else 
				formInnerWhereClause += ' where Approved_Credit__c = :approvedCreditAmount ';
		}
		
		if(claimedCommissionOperator == '<' && claimedCommissionAmount != 0)
		{
			formWhereClause += ' and Commission_Amount__c < :claimedCommissionAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Requested_Commission__c < :claimedCommissionAmount ';
			else 
				formInnerWhereClause += ' where Requested_Commission__c < :claimedCommissionAmount ';
		}
		else if(claimedCommissionOperator == '>' && claimedCommissionAmount != 0)
		{
			formWhereClause += ' and Commission_Amount__c > :claimedCommissionAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Requested_Commission__c > :claimedCommissionAmount ';
			else 
				formInnerWhereClause += ' where Requested_Commission__c > :claimedCommissionAmount ';
		}
		else if(claimedCommissionOperator == '=' && claimedCommissionAmount != 0)
		{
			formWhereClause += ' and Commission_Amount__c = :claimedCommissionAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Requested_Commission__c = :claimedCommissionAmount ';
			else 
				formInnerWhereClause += ' where Requested_Commission__c = :claimedCommissionAmount ';
		}
		
		if(approvedCommissionOperator == '<' && approvedCommissionAmount != 0)
		{
			formWhereClause += ' and Commission_Amount__c < :approvedCommissionAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Approved_Commission__c < :approvedCommissionAmount ';
			else 
				formInnerWhereClause += ' where Approved_Commission__c < :approvedCommissionAmount ';
		}
		else if(approvedCommissionOperator == '>' && approvedCommissionAmount != 0)
		{
			formWhereClause += ' and Commission_Amount__c > :approvedCommissionAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Approved_Commission__c > :approvedCommissionAmount ';
			else 
				formInnerWhereClause += ' where Approved_Commission__c > :approvedCommissionAmount ';
		}
		else if(approvedCommissionOperator == '=' && approvedCommissionAmount != 0)
		{
			formWhereClause += ' and Commission_Amount__c = :approvedCommissionAmount ';
			if(formInnerWhereClause.indexOf('where') != -1)
				formInnerWhereClause += ' and Approved_Commission__c = :approvedCommissionAmount ';
			else 
				formInnerWhereClause += ' where Approved_Commission__c = :approvedCommissionAmount ';
		}
		formInnerWhereClause += ' ) ';
		
        try
        {
        	System.debug('select Id, Name, Opportunity__c, Opportunity__r.Name, Claim_Status__c, Commission_Rate__c, Commission_Amount__c, Credit__c, Adjusted_Commission__c, Adjusted_Credit__c, Filing_Date__c, Assigned_To__c '+formInnerWhereClause+' from Callidus_Claim__c where '+formWhereClause+'  ------------ '+claimName);
            claimsList = Database.query('select Id, Name, Opportunity__c, Opportunity__r.Name, Claim_Status__c, Commission_Rate__c, Commission_Amount__c, Credit__c, Adjusted_Commission__c, Adjusted_Credit__c, Participant__c, Is_Multiple_Claimants__c, Filing_Date__c, Assigned_To__c '+formInnerWhereClause+' from Callidus_Claim__c where '+formWhereClause+' order by createddate desc');
            
            if(claimsList != null && claimsList.size() == 0)
                claimsList = null;
        }
        catch(Exception e)
        {
            Apexpages.addMessage(new Apexpages.Message(ApexPages.severity.info ,e.getMessage()));
        }
        return null;
    }
    
    public PageReference withdrawClaim()
    {
        Callidus_Claim__c[] claimList = [select claim_status__c from Callidus_Claim__c where id = :withdrawnClaimId];
        if(claimList.size() > 0)
        {
            claimList[0].Claim_Status__c = 'Withdrawn';
            try
            {
                update claimList;
                searchClaims();
            }
            catch(Exception e)
            {
                Apexpages.addMessage(new Apexpages.Message(ApexPages.severity.info ,e.getMessage()));
            }
        }
        return null;
    }
    
    Boolean displayAssignedToFlag = false;
    public String checkCC()
    {
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        return 'success';      
    }

    static testMethod void testCald_SearchClaimsVF()
    {
        PageReference pg = Page.Cald_Search_Claims;
        Cald_SearchClaimsVF sc = new Cald_SearchClaimsVF();
        
        Callidus_Plan__c plan = new Callidus_Plan__c(Name = 'Test', Start_Date__c = Date.today(), End_Date__c = (Date.today() + 100), Quota__c = 1000000, Type__c = 'byRole');

        Test.startTest();
        insert plan;
		List<Callidus_Plan__c> tPlan = [select Name from Callidus_Plan__c where id = :plan.id];
		for(Callidus_Plan__c p:tPlan)
		{
			System.assertEquals('Test', p.Name);
		}

        Callidus_Rate__c rate = new Callidus_Rate__c(Plan__c = plan.id, Min_Attainment__c = 0, Max_attainment__c = 100, Rate__c = 1, Rate_Type__c = 'Attainment');
        insert rate;
		List<Callidus_Rate__c> tRate = [select Rate_Type__c from Callidus_Rate__c where Plan__c = :plan.id];
		for(Callidus_Rate__c p:tRate)
		{
			System.assertEquals('Attainment', p.Rate_Type__c);
		}

        rate = new Callidus_Rate__c(Plan__c = plan.id, Min_Attainment__c = 100, Max_attainment__c = 110, Rate__c = 2, Rate_Type__c = 'Attainment');
        insert rate;
		tRate = [select Rate__c, Rate_Type__c from Callidus_Rate__c where Plan__c = :plan.id];
		for(Callidus_Rate__c p:tRate)
		{
			System.assertEquals('Attainment', p.Rate_Type__c);
		}
        
        sc.c = new Callidus_Claim__c(Claim_Status__c = 'Pending', Filing_Date__c = Date.today(), Participant__c = UserInfo.getUserId(), Plan__c = plan.id);
        insert sc.c;
		List<Callidus_Claim__c> tClaim = [select Claim_Status__c from Callidus_Claim__c where Plan__c = :plan.id];
		for(Callidus_Claim__c p:tClaim)
		{
			System.assertEquals('Pending', p.Claim_Status__c);
		}

        sc.claimName = sc.c.Name;
        sc.claimStatus = sc.c.Claim_Status__c;
        sc.filingDate = sc.c.Filing_Date__c;
        sc.c.Claim_Status__c = 'Approved';
        system.assertEquals('Approved', sc.c.Claim_Status__c);
        update sc.c;
		tClaim = [select Claim_Status__c from Callidus_Claim__c where Plan__c = :plan.id];
		for(Callidus_Claim__c p:tClaim)
		{
			System.assertEquals('Approved', p.Claim_Status__c);
		}
		
		List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('select', 'Select'));
        options.add(new SelectOption('Pending Approval', 'Pending Approval'));
        options.add(new SelectOption('Approved', 'Approved'));
        options.add(new SelectOption('Rejected', 'Rejected'));
        options.add(new SelectOption('Withdrawn', 'Withdrawn'));
        system.assertEquals(options.get(1).getValue(), sc.getClaimStatusList().get(1).getValue());

        system.assertEquals(null, sc.searchClaims());
        System.assertEquals('success', sc.checkCC());
        
        sc.withdrawnClaimId = sc.c.Id;
        system.assertEquals(null, sc.withdrawClaim());
		

        sc.c.Claim_Status__c = 'Withdrawn';
        update sc.c;
        Test.stopTest();
		tClaim = [select Claim_Status__c from Callidus_Claim__c where Plan__c = :plan.id];
		for(Callidus_Claim__c p:tClaim)
		{
			System.assertEquals('Withdrawn', p.Claim_Status__c);
		}
		system.assertEquals(null, sc.exportPayment());
		testVar = 'test';
		system.assertEquals(null, sc.getPayments());
    }
}